/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * BuildTraining.java
 *
 * Created on Jun 3, 2010, 1:44:44 AM
 */

package GUI;

import BuildData.AlphaTree;
import BuildData.AlphaTreeData;
import BuildData.GreekTree;
import BuildData.GreekTreeData;
import BuildData.LLMData;
import BuildData.LMData;
import BuildData.NcomTree;
import BuildData.NcomTreeData;
import BuildData.NgangCheoTree;
import BuildData.NgangCheoTreeData;
import BuildData.NumTree;
import BuildData.NumTreeData;
import BuildData.PMData;
import LM.LanguageModel;
import LM.LetterLanguageModel;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.stream.XMLStreamException;

/**
 *
 * @author Kiennt
 */
public class TrainPanel extends javax.swing.JPanel {

    /** Creates new form BuildTraining */
    public TrainPanel() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        taThongBao = new javax.swing.JTextArea();
        jPanel1 = new javax.swing.JPanel();
        ckNumTreeData = new javax.swing.JCheckBox();
        ckNumTree = new javax.swing.JCheckBox();
        ckNcomTreeData = new javax.swing.JCheckBox();
        ckNcomTree = new javax.swing.JCheckBox();
        btnThucHien = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        ckGreekTreeData = new javax.swing.JCheckBox();
        ckGreekTree = new javax.swing.JCheckBox();
        ckLlmASWDData = new javax.swing.JCheckBox();
        ckLlmASWD = new javax.swing.JCheckBox();
        ckLlmEXPNData = new javax.swing.JCheckBox();
        ckLlmEXPN = new javax.swing.JCheckBox();
        ckLlmSEQNData = new javax.swing.JCheckBox();
        ckLlmSEQN = new javax.swing.JCheckBox();
        ckAlphaTreeData = new javax.swing.JCheckBox();
        ckAlphaTree = new javax.swing.JCheckBox();
        jPanel3 = new javax.swing.JPanel();
        ckPmData = new javax.swing.JCheckBox();
        ckPm = new javax.swing.JCheckBox();
        ckLmData = new javax.swing.JCheckBox();
        ckLm = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        ckNcTreeData = new javax.swing.JCheckBox();
        ckNcTree = new javax.swing.JCheckBox();

        setBackground(java.awt.Color.white);
        setPreferredSize(new java.awt.Dimension(1000, 600));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel1.setText("HUẤN LUYỆN");

        jPanel5.setBackground(java.awt.Color.white);
        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Thông báo"));

        taThongBao.setColumns(20);
        taThongBao.setRows(5);
        jScrollPane1.setViewportView(taThongBao);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.setBackground(java.awt.Color.white);
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Phân loại NSW số"));

        ckNumTreeData.setBackground(java.awt.Color.white);
        ckNumTreeData.setText("Thu thập dữ liệu cây sơ bộ");

        ckNumTree.setBackground(java.awt.Color.white);
        ckNumTree.setText("Huấn luyện cây sơ bộ");

        ckNcomTreeData.setBackground(java.awt.Color.white);
        ckNcomTreeData.setText("Thu thập dữ liệu cây ncom");

        ckNcomTree.setBackground(java.awt.Color.white);
        ckNcomTree.setText("Huấn luyện cây ncom");
        ckNcomTree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ckNcomTreeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckNcomTree)
                    .addComponent(ckNumTreeData)
                    .addComponent(ckNcomTreeData)
                    .addComponent(ckNumTree))
                .addContainerGap(33, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ckNumTreeData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckNumTree)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
                .addComponent(ckNcomTreeData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckNcomTree)
                .addContainerGap())
        );

        btnThucHien.setText("Thực hiện");
        btnThucHien.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnThucHienMouseClicked(evt);
            }
        });

        jPanel2.setBackground(java.awt.Color.white);
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Phân loại NSW chữ"));

        ckGreekTreeData.setBackground(java.awt.Color.white);
        ckGreekTreeData.setText("Thu Thập dữ liệu cây greek");

        ckGreekTree.setBackground(java.awt.Color.white);
        ckGreekTree.setText("Huấn luyện cây greek");

        ckLlmASWDData.setBackground(java.awt.Color.white);
        ckLlmASWDData.setText("Thu thập dữ liệu LLM ASWD");

        ckLlmASWD.setBackground(java.awt.Color.white);
        ckLlmASWD.setText("Huấn luyện LLM ASWD");

        ckLlmEXPNData.setBackground(java.awt.Color.white);
        ckLlmEXPNData.setText("Thu thập dữ liệu LLM EXPN");

        ckLlmEXPN.setBackground(java.awt.Color.white);
        ckLlmEXPN.setText("Huấn luyện LLM EXPN");

        ckLlmSEQNData.setBackground(java.awt.Color.white);
        ckLlmSEQNData.setText("Thu thập dữ liệu LLM SEQN");

        ckLlmSEQN.setBackground(java.awt.Color.white);
        ckLlmSEQN.setText("Huấn luyện LLM SEQN");

        ckAlphaTreeData.setBackground(java.awt.Color.white);
        ckAlphaTreeData.setText("Thu thập dữ liệu cho cây AES");

        ckAlphaTree.setBackground(java.awt.Color.white);
        ckAlphaTree.setText("Huấn luyện cây AES");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckGreekTreeData)
                    .addComponent(ckGreekTree)
                    .addComponent(ckLlmASWDData)
                    .addComponent(ckLlmASWD)
                    .addComponent(ckLlmEXPN)
                    .addComponent(ckLlmSEQNData)
                    .addComponent(ckLlmSEQN)
                    .addComponent(ckLlmEXPNData)
                    .addComponent(ckAlphaTreeData)
                    .addComponent(ckAlphaTree))
                .addContainerGap(21, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(ckGreekTreeData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ckGreekTree)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckLlmASWDData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckLlmASWD)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckLlmEXPNData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckLlmEXPN)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckLlmSEQNData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckLlmSEQN)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ckAlphaTreeData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ckAlphaTree)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        jPanel3.setBackground(java.awt.Color.white);
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Khôi phục từ viết tắt"));

        ckPmData.setBackground(java.awt.Color.white);
        ckPmData.setText("Thu thuâp dữ liệu mô hình xác suất");

        ckPm.setBackground(java.awt.Color.white);
        ckPm.setText("Huấn luyện mô hình xác suất");

        ckLmData.setBackground(java.awt.Color.white);
        ckLmData.setText("Thu thập dữ liệu LM");

        ckLm.setBackground(java.awt.Color.white);
        ckLm.setText("Huấn luyện LM");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckPmData)
                    .addComponent(ckPm)
                    .addComponent(ckLmData)
                    .addComponent(ckLm))
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ckPmData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckPm)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckLmData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(ckLm))
        );

        jPanel4.setBackground(java.awt.Color.white);
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Xác định cách đọc - & /"));

        ckNcTreeData.setBackground(java.awt.Color.white);
        ckNcTreeData.setText("Thu thập dữ liệu cây -&/");

        ckNcTree.setBackground(java.awt.Color.white);
        ckNcTree.setText("Huấn luyện cây -&/");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckNcTreeData)
                    .addComponent(ckNcTree))
                .addContainerGap(65, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(ckNcTreeData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ckNcTree))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(476, 476, 476)
                .addComponent(jLabel1)
                .addContainerGap(431, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(151, 151, 151)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(205, 205, 205))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(82, 82, 82)
                        .addComponent(btnThucHien)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(138, 138, 138)
                                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnThucHien, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(257, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void ckNcomTreeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckNcomTreeActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_ckNcomTreeActionPerformed

    private void btnThucHienMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnThucHienMouseClicked

      // TODO add your handling code here:
        if(ckNumTreeData.isSelected()){
      
                taThongBao.append("Thu thập dữ liệu cho cây sơ bộ...\n");
                taThongBao.repaint();
            System.out.println("Thu thập dữ liệu cho cây sơ bộ...\n");
            try {
                NumTreeData ntd = new NumTreeData();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
           

        }
        if(ckNumTree.isSelected()){
            try {
                taThongBao.append("Huấn luyện cho cây sơ bộ...\n");
            System.out.println("Huấn luyện cho cây sơ bộ...\n");
                NumTree nt = new NumTree();
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);

            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            
        }
        if(ckNcomTreeData.isSelected()){
            try {
                taThongBao.append("Thu thập dữ liệu cho cây NCOM...\n");
                NcomTreeData ntd = new NcomTreeData();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            
            
        }
        if(ckNcomTree.isSelected()){
            try {
                taThongBao.append("Huấn luyện cho cây NCOM...\n");
                NcomTree nct = new NcomTree();
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);

            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            
        }
        if(ckGreekTreeData.isSelected()){
            try {
                GreekTreeData nt = new GreekTreeData();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Thu thập dữ liệu cho cây GREEK...\n");
        }

        if(ckGreekTree.isSelected()){
            try {
                GreekTree gt = new GreekTree();
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);

            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Huấn luyện cho cây GEEK...\n");
        }
        if(ckLlmASWDData.isSelected()){
            try {
                LLMData llmd = new LLMData();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Thu thập dữ liệu cho mô hình ngôn ngữ ASWD...\n");
        }
        if(ckLlmASWD.isSelected()){
            LetterLanguageModel llmAswd=new LetterLanguageModel();
            try {
                llmAswd.createModel("data\\llm\\aswd.db");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            try {
                llmAswd.writeModelFile("data\\llm\\llmAswd.db");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Huấn luyện cho mô hình ngôn ngữ ASWD...\n");
        }

        if(ckLlmEXPNData.isSelected()){
            try {
                LLMData llmd = new LLMData();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Thu thập dữ liệu cho mô hình ngôn ngữ EXPN...\n");
        }

        if(ckLlmEXPN.isSelected()){
            LetterLanguageModel llmExpn=new LetterLanguageModel();
            try {
                llmExpn.createModel("data\\llm\\expn.db");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            try {
                llmExpn.writeModelFile("data\\llm\\llmExpn.db");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Huấn luyện cho mô hình ngôn ngữ EXPN...\n");
        }
        if(ckLlmSEQNData.isSelected()){
            try {
                LLMData llmd = new LLMData();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Thu thập dữ liệu cho mô hình ngôn ngữ SEQN...\n");
        }
        if(ckLlmSEQN.isSelected()){
            LetterLanguageModel llmSeqn=new LetterLanguageModel();
            try {
                llmSeqn.createModel("data\\llm\\seqn.db");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            try {
                llmSeqn.writeModelFile("data\\llm\\llmSeqn.db");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Huấn luyện cho mô hình ngôn ngữ EXPN...\n");
        }

        if(ckAlphaTreeData.isSelected()){
            try {
                AlphaTreeData atd = new AlphaTreeData();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Thu thập dữ liệu cho cây AES...\n");
        }
        if(ckAlphaTree.isSelected()){
            try {
                AlphaTree at = new AlphaTree();
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);

            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Huấn luyện cho cây AES...\n");
        }

        if(ckPmData.isSelected()){
            try {
                PMData pmd = new PMData();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Thu thập dữ liệu cho mô hình xác suất...\n");
        }

       if(ckLmData.isSelected()){
            try {
                LMData lmd = new LMData();
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Thu thập dữ liệu cho mô hình ngôn ngữ ...\n");
       }

        if(ckLm.isSelected()){
            LanguageModel lm=new LanguageModel();
            try {
                lm.createModel();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            try {
                lm.writeModelFile();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Huấn luyện cho mô hình ngôn ngữ...\n");
        }
        
        if(ckNcTreeData.isSelected()){
            try {
                NgangCheoTreeData nctd = new NgangCheoTreeData();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Thu thập dữ liệu cho cây Ngang chéo...\n");
        }
        if(ckNcTree.isSelected()){
            try {
                NgangCheoTree nct = new NgangCheoTree();
            } catch (IOException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
           
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TrainPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            taThongBao.append("Huấn luyện cho cây ngang chéo...\n");
        }
        taThongBao.append("Xong!!!");
    }//GEN-LAST:event_btnThucHienMouseClicked


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnThucHien;
    private javax.swing.JCheckBox ckAlphaTree;
    private javax.swing.JCheckBox ckAlphaTreeData;
    private javax.swing.JCheckBox ckGreekTree;
    private javax.swing.JCheckBox ckGreekTreeData;
    private javax.swing.JCheckBox ckLlmASWD;
    private javax.swing.JCheckBox ckLlmASWDData;
    private javax.swing.JCheckBox ckLlmEXPN;
    private javax.swing.JCheckBox ckLlmEXPNData;
    private javax.swing.JCheckBox ckLlmSEQN;
    private javax.swing.JCheckBox ckLlmSEQNData;
    private javax.swing.JCheckBox ckLm;
    private javax.swing.JCheckBox ckLmData;
    private javax.swing.JCheckBox ckNcTree;
    private javax.swing.JCheckBox ckNcTreeData;
    private javax.swing.JCheckBox ckNcomTree;
    private javax.swing.JCheckBox ckNcomTreeData;
    private javax.swing.JCheckBox ckNumTree;
    private javax.swing.JCheckBox ckNumTreeData;
    private javax.swing.JCheckBox ckPm;
    private javax.swing.JCheckBox ckPmData;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea taThongBao;
    // End of variables declaration//GEN-END:variables

}
